package com.minimalist.common.feign.client.lindi;

import com.minimalist.common.config.mybatis.bo.PageResp;
import com.minimalist.common.entity.lindi.vo.tradeapplication.LindiTradeApplicationAgreeVO;
import com.minimalist.common.entity.lindi.vo.tradeapplication.LindiTradeApplicationQueryVO;
import com.minimalist.common.entity.lindi.vo.tradeapplication.LindiTradeApplicationVO;
import com.minimalist.common.feign.config.FeignConfig;
import com.minimalist.common.feign.fallback.lindi.LindiTradeApplicationFeignClientFallbackFactory;
import com.minimalist.common.response.R;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import jakarta.validation.constraints.NotNull;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author 11987
 */
@FeignClient(name = "minimalist-lindi"
        , contextId = "lindiTradeApplicationFeignClient"
        , path = "/minimalist/lindi/tradeApplication"
        , configuration = FeignConfig.class
        , fallbackFactory = LindiTradeApplicationFeignClientFallbackFactory.class)
public interface LindiTradeApplicationFeignClient{
    /**
     * 添加交易申请
     *
     * @param tradeApplicationVO 交易申请数据
     * @return R
     */
    @PostMapping("/addTradeApplication")
    @Operation(summary = "添加交易申请")
    R<?> addTradeApplication(
            @RequestBody @Validated(Add.class)
            LindiTradeApplicationVO tradeApplicationVO);

    /**
     * 删除交易申请 -> 根据交易申请ID删除
     *
     * @param tradeApplicationId 交易申请ID
     * @return R
     */
    @DeleteMapping("/deleteTradeApplicationByTradeApplicationId")
    @Operation(summary = "删除交易申请 -> 根据交易申请ID删除")
    R<?> deleteTradeApplicationByTradeApplicationId(
            @RequestParam("tradeApplicationId")
            @NotNull(message = "交易申请ID不能为空")
            @Parameter(name = "tradeApplicationId", required = true
                    , description = "交易申请ID")
            Long tradeApplicationId);

    /**
     * 修改交易申请
     *
     * @param tradeApplicationVO 交易申请数据
     * @return R
     */
    @PutMapping("/updateTradeApplicationByTradeApplicationId")
    @Operation(summary = "修改交易申请")
    R<?> updateTradeApplicationByTradeApplicationId(
            @RequestBody @Validated(Update.class)
            LindiTradeApplicationVO tradeApplicationVO);

    /**
     * 查询交易申请列表(分页)
     *
     * @param queryVO 查询实体
     * @return R
     */
    @GetMapping("/getPageTradeApplicationList")
    @Operation(summary = "查询交易申请列表(分页)")
    R<PageResp<LindiTradeApplicationVO>> getPageTradeApplicationList(
            @RequestBody LindiTradeApplicationQueryVO queryVO);

    /**
     * 根据交易申请ID查询交易申请
     *
     * @param tradeApplicationId 交易申请ID
     * @return R
     */
    @GetMapping("/getTradeApplicationByTradeApplicationId/{tradeApplicationId}")
    @Operation(summary = "根据交易申请ID查询交易申请")
    R<LindiTradeApplicationVO> getTradeApplicationByTradeApplicationId(
            @PathVariable(value = "tradeApplicationId")
            @NotNull(message = "交易申请ID不能为空")
            @Parameter(name = "tradeApplicationId", description = "交易申请ID"
                    , required = true)
            Long tradeApplicationId);

    /**
     * 是否同意交易申请
     *
     * @param agreeVO 交易申请同意数据
     * @return R
     */
    @PostMapping("/agreeTradeApplication")
    @Operation(summary = "是否同意交易申请")
    R<?> agreeTradeApplication(
            @RequestBody @Validated(Update.class)
            LindiTradeApplicationAgreeVO agreeVO);

    /**
     * 审批交易申请
     *
     * @param agreeVO 交易申请审批数据
     * @return R
     */
    @PostMapping("/approveTradeApplication")
    @Operation(summary = "审批交易申请")
    R<?> approveTradeApplication(
            @RequestBody @Validated(Update.class)
            LindiTradeApplicationAgreeVO agreeVO);
}
